ποΈGitΠ―ΡΠ°ποΈ
Node / meshtastic / Meshtastic-Android / files / specs / 005-tak-v2-protocol / contracts / wire-protocol.md
specs/005-tak-v2-protocol/contracts/wire-protocol.md fix/qr-error-correction (7b45f84f) Text, 5.56 KB
Wire Protocol Contract: TAK v2 Protocol Integration
Overview
The TAK v2 protocol defines two wire formats for transmitting Cursor-on-Target (CoT) events over the Meshtastic LoRa mesh network. This contract documents the encoding, port assignment, and interoperability guarantees.
Port Assignments
ββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββ
β Port β Protobuf PortNum β Protocol β Firmware Requirement β
ββββββββΌβββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββ€
β 72 β T383838ATAK_PLUGIN β TAKPacket (v1) β Any version β
β 78 β T383838ATAK_PLUGIN_V2 β TAKPacketV2 (v2) β β₯ 2.8.0 β
ββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββ
TAKPacketV2 Wire Format (Port 78)
Byte Layout
T282828
Offset Size Field
0 1 Flags byte
1 N Payload (compressed or raw TAKPacketV2 protobuf)
Total: 1 + N bytes, where (1 + N) β€ 225 bytes
Flags Byte Encoding
βββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Value β Meaning β
βββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 0x00 β Compressed with non-aircraft dictionary (ID 0) β
β 0x01 β Compressed with aircraft dictionary (ID 1) β
β 0x02-0xFE β Reserved for future dictionaries β
β 0xFF β Uncompressed (raw TAKPacketV2 protobuf, no zstd) β
βββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββ
Compression
β’ Algorithm: Zstd (Zstandard) with pre-trained dictionaries
β’ Dictionary selection: Based on CoT type β aircraft types (T383838a-*-A-*) use dict 1, all others use dict 0
β’ Library: T383838meshtastic/TAKPacket-SDK v0.1.3 (wraps zstd-jni)
β’ Max decompressed size: 4096 bytes (reject larger to prevent memory exhaustion)
TAKPacketV2 Protobuf Schema
The protobuf is defined upstream in T383838meshtastic/protobufs. Key payload types:
ββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Payload Type β CoT Types Covered β
ββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β T383838pli β All T383838a-* position reports (friendly, hostile, unknown, neutral) β
β T383838chat β T383838b-t-f GeoChat messages β
β T383838raw_detail β All other CoT types (shapes, markers, routes, etc.) β
ββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PLI Payload Fields
βββββββββββββββ¬βββββββββ¬ββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββ
β Field β Type β Scaling β Notes β
βββββββββββββββΌβββββββββΌββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββ€
β latitude_i β int32 β Γ 1e7 β WGS84 degrees β
β longitude_i β int32 β Γ 1e7 β WGS84 degrees β
β altitude β int32 β meters β HAE β
β speed β uint32 β Γ 100 β m/s β cm/s β
β course β uint32 β Γ 100 β degrees β centidegrees β
β cottypeid β enum β β β Mapped CoT type β
β cottypestr β string β β β Original type for round-trip (CotType_Other) β
βββββββββββββββ΄βββββββββ΄ββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββ
GeoChat Payload Fields
βββββββββββββββββββ¬βββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ
β Field β Type β Notes β
βββββββββββββββββββΌβββββββββΌββββββββββββββββββββββββββββββββββββββββββ€
β message β string β Chat message text β
β to β string β Recipient UID or chatroom name β
β device_callsign β string β T383838<senderUid>|<messageId> (UID smuggling) β
βββββββββββββββββββ΄βββββββββ΄ββββββββββββββββββββββββββββββββββββββββββ
Raw Detail Payload
ββββββββββββββ¬ββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Field β Type β Notes β
ββββββββββββββΌββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β raw_detail β bytes β Stripped inner T383838<detail> XML (16 elements removed) β
ββββββββββββββ΄ββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ
TAKPacket Wire Format (Port 72, Legacy)
Byte Layout
T282828
Offset Size Field
0 N Raw TAKPacket protobuf (no header, no compression)
Supported Payload Types (v1)
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β Type β Support β
βββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ€
β PLI (position) β β
Full β
β GeoChat β β
Full β
β Markers/Shapes/Routes β β Not representable in v1 schema β
βββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
TAK Server Protocol (Port 8089)
Transport
β’ Protocol: TCP with TLS 1.2+ (mTLS required)
β’ Port: 8089 (configurable via TAK server standard)
β’ Binding: T383838127.0.0.1 (loopback) + LAN interfaces
β’ Authentication: Mutual TLS β server presents T383838server.p12, client presents T383838client.p12, both trust T383838ca.pem
Message Framing
CoT events are sent as complete XML documents over the TLS stream:
T282828
Tff7b72<?xml version="1.0" encoding="UTF-8"?>
Tff7b72<event Te6edf3version=Ta5d6ff"2.0" Te6edf3uid=Ta5d6ff"..." Te6edf3type=Ta5d6ff"..." Te6edf3time=Ta5d6ff"..." Te6edf3start=Ta5d6ff"..." Te6edf3stale=Ta5d6ff"..." Te6edf3how=Ta5d6ff"..."Tff7b72>
Tff7b72<point Te6edf3lat=Ta5d6ff"..." Te6edf3lon=Ta5d6ff"..." Te6edf3hae=Ta5d6ff"..." Te6edf3ce=Ta5d6ff"..." Te6edf3le=Ta5d6ff"..."Tff7b72/>
Tff7b72<detailTff7b72>
T8b949e<!-- Type-specific detail elements -->
Tff7b72</detail>
Tff7b72</event>
Events are framed by detecting the closing T383838</event> tag via T383838CoTXmlFrameBuffer.
Keepalive
β’ Interval: 10 seconds
β’ Format: Empty ping CoT event (T383838t-x-d-d type)
β’ Purpose: Maintain connection below ATAK's 15-second stale threshold
Data Package Format (.zip)
Connection Data Package
Exported for ATAK/iTAK client configuration:
T282828
Meshtastic_TAK_Server.zip
βββ meshtastic-server.pref # ATAK connection preferences (XML)
βββ truststore.p12 # CA certificate for server verification
βββ client.p12 # Client identity for mTLS
βββ manifest.xml # MissionPackageManifest v2
Route Data Package
Generated on receiving end for ATAK route import:
T282828
{route_uid}.zip
βββ {route_uid}.kml # KML LineString with waypoints
βββ manifest.xml # MissionPackageManifest v2
Inbound Processing Rules
ββββββββββββββββββββββββ¬βββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Source Port β Local Firmware β Action β
ββββββββββββββββββββββββΌβββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 78 (V2) β Any β Decompress β decode β broadcast to TAK clients β
β 72 (V1) β Any β Decode raw protobuf β broadcast to TAK clients β
β 78 (V2) + route type β Any β Decompress β decode β generate KML β broadcast + write β¦ β
ββββββββββββββββββββββββ΄βββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Outbound Processing Rules
βββββββββββββββββββ¬βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββ
β CoT Type β Local Firmware β₯ 2.8.0 β Local Firmware < 2.8.0 β
βββββββββββββββββββΌβββββββββββββββββββββββββββΌββββββββββββββββββββββββββ€
β PLI (T383838a-*) β V2 (port 78, compressed) β V1 (port 72, raw proto) β
β GeoChat (T383838b-t-f) β V2 (port 78, compressed) β V1 (port 72, raw proto) β
β All others β V2 (port 78, compressed) β DROPPED (log warning) β
βββββββββββββββββββ΄βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββ
MTU Enforcement
β’ Max wire payload: 225 bytes (after protobuf framing within 237-byte LoRa MTU)
β’ If compressed payload exceeds 225 bytes: attempt remarks stripping, then drop with warning
β’ Never fragment; never queue oversized packets
Served by rngit 1.5.0 - Generated in 0.05s